#include <stdio.h>
#include <string.h>

int atoi(const char *s)
{
    int a = 0;
    int sign = 1;
    if(*s == '-')
        sign = -1;
    int len = strlen(s);
    for(int i = 0; i < len;i++)
    {
        if(*s >= '0' && *s <= '9')
            a = (s[i] - '0') + a * 10;
    }
    return a * sign;
}


int main()
{
    const char *str = "12345";
    int a = atoi(str);
    printf("%d\n",a);
    return 0;
}